﻿using System;
using System.Text;

namespace mfLogger
{
    /// <summary>
    /// common interface description for all appenders
    /// </summary>
    public interface ILoggerAppender
    {
        /// <summary>
        /// name to the instaniates appender
        /// </summary>
        string Name { get; }

        /// <summary>
        /// flag, which determines, if the appender is enabled
        /// </summary>
        bool IsEnabled { get; set; }

        /// <summary>
        /// current trace-level for this appender
        /// </summary>
        enumLogMessageLevel Level { get; set; }

        /// <summary>
        /// logs a instantiated mfLogger-message (invokes HandleMessage)
        /// </summary>
        /// <param name="msg">the message to log</param>
        void Log(mfLogMessage msg);

        /// <summary>
        /// logs the text on debug-trace-level
        /// </summary>
        /// <param name="text">the text to log</param>
        void Debug(string text);

        /// <summary>
        /// logs the text on info-trace-level
        /// </summary>
        /// <param name="text">the text to log</param>
        void Info(string text);

        /// <summary>
        /// logs the text on warning-trace-level
        /// </summary>
        /// <param name="text">the text to log</param>
        void Warning(string text);

        /// <summary>
        /// logs the specified exception-object
        /// </summary>
        /// <remarks>automic on error-trace-level</remarks>
        /// <param name="ex">the exception to log</param>
        void Error(Exception ex);

        /// <summary>
        /// logs the text on error-trace-level
        /// </summary>
        /// <param name="text">the text to log</param>
        void Error(string text);

        /// <summary>
        /// handles the a log message 
        /// </summary>
        /// <remarks>
        /// forces the appender to implement a handle method, which logs depending on the concrete-trace-level
        /// </remarks>
        /// <param name="msg">the log message to handle</param>
        void HandleMessage(mfLogMessage msg);
    }
}
